#ifndef SINGLETON_HPP_INCLUDED
#define SINGLETON_HPP_INCLUDED

template <typename T> class Singleton {
	protected:
		Singleton () { }
		~Singleton () { }
	private:
		static T *mySingleton;
	public:
		static T *getSingleton() {
			if (0 == mySingleton) mySingleton = new T;
			return (static_cast<T*> (mySingleton));
		}
		
		static void kill() {
			if (0 != mySingleton) {
				delete mySingleton;
				mySingleton = 0;
			}
		}
};

template <typename T> T *Singleton<T>::mySingleton = 0;
#endif
